﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:AttachedProperties="clr-namespace:Snipps.Infrastructure.AttachedProperties"
                    xmlns:Common="clr-namespace:Snipps.Infrastructure">

    <ResourceDictionary.MergedDictionaries>
        <Common:SharedResourceDictionary Source="/Snipps;component/Resources/ControlTemplates/ValidationErrorTemplate.xaml" />
        <Common:SharedResourceDictionary Source="/Snipps;component/Resources/NamedStyles/ColorBorderOnFocusStyle.xaml" />
        <Common:SharedResourceDictionary Source="/Snipps;component/Resources/BaseControlStyles/ScrollBarStyle.xaml" />
    </ResourceDictionary.MergedDictionaries>


    <Style BasedOn="{StaticResource ColorBorderOnFocusStyle}"
           TargetType="{x:Type TextBox}">
        <Setter Property="AttachedProperties:SetLastCaretIndexBehavior.IsEnabled" Value="True" />
        <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
        <Setter Property="Background" Value="{DynamicResource BackgroundBrush}" />
        <Setter Property="BorderThickness" Value="{DynamicResource BorderThickness}" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="CaretBrush" Value="{DynamicResource ForegroundBrush}" />
        <Setter Property="FontSize" Value="{DynamicResource TxtBoxFontSize}" />
        <Setter Property="Validation.ErrorTemplate" Value="{StaticResource ValidationErrorTemplate}" />
        <Setter Property="Background" Value="{DynamicResource BackgroundBrush}" />
        <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <ScrollViewer x:Name="PART_ContentHost"
                                      Margin="0" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>